package com.lagou.wwyan.blog.service.impl;

import com.lagou.wwyan.blog.dao.ArticleRepository;
import com.lagou.wwyan.blog.entity.Article;
import com.lagou.wwyan.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    private ArticleRepository articleRepository;
    @Override
    public Page<Article> getPage(int page, int size){
        Pageable pageable = PageRequest.of(page ,size);
        return articleRepository.findAll(pageable);

    }
}
